<template>
	<view class="list redruit-list">
		<view class="item" v-for=" (item,index) in list" :key="index">
			<!-- 		<view class="acea-row row-middle row-between top-info">
				<view>3天内更新</view>
				<view class="close">×</view>
			</view> -->
			<view class="acea-row row-middle row-between"
				@click="toPages('/pages/details/jobHunting/jobHunting?notEdit=1&id=' + item.id)">
				<view class="title line1">
					{{ item.title }}
				</view>
				<view class="price">
					{{ item.salary?(item.salary.split('-')[0]?item.salary.split('-')[0]+'k':'')+(item.salary.split('-')[1]?'-'+item.salary.split('-')[1]+'k':''):'' }}
				</view>

			</view>

			<view class="acea-row goods-tag" v-if="item.mark">
				<block v-for="child in item.mark.split('/')">
					<view class="tag">{{ child }}</view>
				</block>
			</view>
			<view class="acea-row row-between row-middle contact-box">
				<view class="acea-row row-middle contact-info" @click="toDetail(item)">
					<image
						:src="item.contacts&&item.contacts.length>0?item.contacts[0].avatar:'../../static/images/f.png'"
						mode=""></image>
					<view class="name">
						<view class="line1">
							联系人：{{item.contacts&&item.contacts.length>0?item.contacts[0].contactName : ''}}</view>
						<view class="line1">
							联系电话：{{item.contacts&&item.contacts.length>0?item.contacts[0].contactPhone.replace(/(\d{3})\d*(\d{4})/,'$1****$2'):''}}
						</view>
					</view>
				</view>
				<view class="visit-l" v-if="toZx">
					<view class="visit-num">{{item.communication || 0}}人咨询</view>
					<view class="visit-btn" @click="toContact(item.contacts)">
						立即咨询
					</view>
				</view>
			</view>
			<view class="acea-row row-middle distance"  v-if="toZx">
				<image src="@/static/images/location_gray.png" mode=""></image>
				<text>距您{{ item.distance?Number(item.distance).toFixed(2):'' }}公里</text>
			</view>
			<view class="acea-row row-middle row-between visit-box"  v-if="toZx">
				<view class="visit-advtar" @click="toVisitor(item)">
					<image :src="m.avatar" mode="" v-for="(m,ind) in item.managementResponse?item.managementResponse:[]"
						:key="ind" :style="{left: (20 * ind) + 'rpx'}"></image>
				</view>
				<view class="acea-row row-middle row-between visit-l">
					<!-- <view class="visit-num">{{item.view ||  0}}人浏览 已成功匹配{{item.matchingNum?item.matchingNum:0}}人</view> -->
					<view class="visit-num"> <text @click="toVisitor(item)">{{item.view ||  0}}人浏览</text>
						已成功匹配{{ Math.floor(Math.random() * (500 - 50 + 1)) + 50 }}人</view>
				</view>
			</view>
			<!-- 浏览、咨询统计 -->
			<!-- 	<view class="acea-row row-middle row-between visit-box">
				<view class="visit-advtar" @click="toVisitor(item)">
					<image :src="m.avatar" mode="" v-for="(m,ind) in item.viewsPhoto?item.viewsPhoto:[]" :key="ind"
						:style="{left: (20 * ind) + 'rpx'}"></image>
				</view>
				<view class="acea-row row-middle row-between visit-l">
					<view class="visit-num">{{item.view ||  0}}人浏览
						已成功匹配{{ Math.floor(Math.random() * (500 - 50 + 1)) + 50 }}人</view>
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		toPage
	} from '@/filters/commFilter.js'
	import topping from '@/pages/releases/components/topping.vue'
	import setting from '@/pages/releases/components/setting.vue'
	import {
		reardTrusteeship
	} from '@/api/api.js'
	export default {
		components: {
			topping,
			setting
		},
		props: {
			list: {
				type: Array,
				default: () => {
					return [1, 1, 1]
				}
			},
			canClose: {
				type: Boolean,
				default: () => {
					return false
				}
			},
			detail: {
				type: Object,
				default: () => {
					return {}
				}
			},
			toZx: {
				type: Boolean,
				default: () => {
					return true
				}
			}
		},
		data() {
			return {
				linkShow: false,
				linkId: 0,
				linkTypes: '',
				setShow: false,
				settingItem: {}
			}
		},
		methods: {
			toPage,
			toVisitor(item) {
				item.vistype = item.type == 0 ? 5 : 10
				uni.navigateTo({
					url: "/pages/aboutUsers/aboutUsers/visitor?data=" + JSON.stringify(item)
				})
			},
			toOpear(message) {
				this.$util.Tips({
					title: message
				})
			},
			toConcat(contact) {
				if (!contact || contact.length < 1) {
					this.$util.Tips({
						title: '暂未获取到联系人'
					})
					return;
				}

				getApp().globalData.into_singleChatRoom({
					phone: contact[0].contactPhone,
					contactId: contact[0].contactId,
				})
			},
			kmUnit(m) {
				m = Number(m)
				var v;
				if (typeof m === 'number' && !isNaN(m)) {
					if (m > 10000) {
						m = 0;
					}
					if (m >= 1) {
						v = m.toFixed(2) + 'km'
					} else {
						v = (m * 1000).toFixed(2) + 'm'
					}
				} else {
					v = '0m'
				}
				return v;
			},
			toPages(path) {
				uni.navigateTo({
					url: path
				})
			},
			//托管方法
			tgMeth(id) {
				let that = this;

				uni.showModal({
					title: "提示",
					content: "是否立即托管",
					success(res) {
						if (res.confirm) {
							reardTrusteeship({
								id
							}).then(res => {
								if (res.code == 200) {
									that.$util.Tips({
										title: '托管成功'
									})
									setTimeout(() => {
										that.page = 1;
										that.initList();
									}, 1500)

								}
							}).catch(e => {
								that.$util.Tips({
									title: e
								}, {
									tab: 2,
									url: "/pages/users/user_money/index"
								})
							})
						}
					}

				})

			},
		}
	}
</script>

<style lang="scss" scoped>
	@import "@/components/listItems/index.scss";

	.redruit-list {
		.title {
			width: 55%;
			font-size: 32rpx;
			font-weight: 500;
			color: rgba(56, 56, 56, 1);
		}

		.price {
			font-size: 36rpx;
			font-weight: 500;
			color: rgba(238, 33, 45, 1);
		}

		.goods-tag {
			margin-top: 18rpx;

			.tag {
				white-space: nowrap;
				border-radius: 4px;
				background: rgba(255, 232, 234, 1);
				padding: 6rpx 12rpx;
				margin-right: 12rpx;
				font-size: 24rpx;
				font-weight: 400;
				color: rgba(238, 33, 45, 1);
			}

			.tag:last-child {
				margin-right: 0;
			}
		}

		.contact-info {
			width: 70%;

			image {
				width: 70rpx;
				height: 70rpx;
				border-radius: 50%;
			}

			.name {
				width: calc(100% - 100rpx);
				height: 70rpx;
				font-size: 26rpx;
				font-weight: 400;
				color: rgba(128, 128, 128, 1);
				margin-left: 24rpx;
			}
		}

		.visit-l {
			width: 30%;

			.visit-num {
				text-align: center;
				font-size: 24rpx;
				font-weight: 400;
				color: rgba(166, 166, 166, 1);
				margin-bottom: 12rpx;
			}

			.visit-btn {
				width: 200rpx;
				height: 60rpx;
				line-height: 60rpx;
				opacity: 1;
				border-radius: 30rpx;
				background: rgba(238, 33, 45, 1);
				text-align: center;
				font-size: 28rpx;
				font-weight: 400;
				color: rgba(255, 255, 255, 1);
			}
		}

		.distance {
			width: 100%;
			padding: 0 12rpx 12rpx;
			font-size: 22rpx;
			font-weight: 400;
			color: rgba(166, 166, 166, 1);

			image {
				width: 18rpx;
				height: 24rpx;
				margin-right: 6rpx;
			}
		}

		// 浏览咨询统计
		.visit-box {
			padding: 30rpx 0;
			margin-top: 30rpx;
			border-top: 1px solid rgba(238, 238, 238, 1);

			.visit-advtar {
				width: 40%;
				height: 46rpx;
				position: relative;

				image {
					width: 46rpx;
					height: 46rpx;
					border-radius: 50%;
					position: absolute;
				}
			}

			.visit-l {
				width: 60%;
				height: 46rpx;

				.visit-num {
					font-size: 26rpx;
					font-weight: 400;
					color: rgba(166, 166, 166, 1);
				}
			}

		}

	}
</style>